<?php

class Email extends CI_Controller {
    
    function Email() {
        parent::__construct();
    }
    
    public function index() {
    }
    
    public function sendEmail($from, $sender, $to, $subject, $message) {
        $this->load->library('email');

        $this->email->clear();

        $this->email->from($from, $sender);
        $this->email->to($to);
        //$this->email->cc($from);
        //$this->email->bcc($from);

        $this->email->subject($subject);
        $this->email->message($message);

        $this->email->send();

        //echo $this->email->print_debugger();        
    }
    
    public function sendContactEmail() {
        $data = $this->input->post();
        
        $this->sendEmail($data['email'], $data['title'] . ' ' . $data['firstname'] . ' ' . $data['lastname'] . ' - ' . $data['company'], 'vulovic.zeljko@gmail.com', 'agent24 contact', $data['message']);
        
        $this->load->view('layout/email_success');
        
        //redirect('','refresh');
    }
    
}

?>